import 'package:casdon/core/logger/log.dart';
import 'package:casdon/core/network/business_exception.dart';
import 'package:casdon/modules/home/data/api/auth_user_info_api.dart';
import 'package:casdon/modules/home/data/repository/home_repository.dart';

class AuthUserInfoUsecase {
  final HomeRepository _repository;

  const AuthUserInfoUsecase(this._repository);

  Future<ResponseAuthUserInfoApi?> execute() async {
    try {
      var ret = await _repository.getUserInfo();
      return ret;
    } on BusinessException {
      rethrow;
    } catch (e) {
      Log.e("AuthUserInfoUsecase 失败", e.toString(), StackTrace.current);
      throw Exception("AuthUserInfoUsecase 失败");
    }
  }
}